|
오라클 실습 |
[1] |
|
등록일:2009-05-28 00:15:02 (0%) 작성자: 제목:2. In line View를 이용한 group by 의 효과적인 처리 |
|
2. In line View를 이용한 group by 의 효과적인 처리
- Sale Table: Product_no + Salesdate
- Product Table : Product_no 에 인덱스가 있다.
예) Select product_no, sum(sale_amt*unit_price)
From sale
Where product_no between ‘P2150’ and ‘P2160’
And saledate like ‘1997%’
Group by product_no;
문제: Sale테이블에 결합인덱스가 있으나 범위가 너무 넓기 때문에 성능이 저하된다. 그러므로 처리 범위를 줄여주어야 한다.
<개선안>
Select a.product_no, sum(a.sale_amt*unit_price)
From product a,
(select product_no from product where product_no between ‘P2150’ and ‘P2160’) b
where a.product_no = b.product_no
and a.saledate like ‘1995%’
group by a.product_no;
또는 sale과 product table을 조인하여 그 결과를 수행한다. |
[본문링크] 2. In line View를 이용한 group by 의 효과적인 처리
|
[1]
|
|
|
|
|
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=31500 |
|
|
|
|
|
|
|
|
|
Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.
|
|
|